package com.kaiwukj.android.ufamily.utils;

import android.text.TextUtils;

public class EncryptUtils {

    public static String mobileEncrypt(String mobile) {
        if (TextUtils.isEmpty(mobile) || (mobile.length() != 11)) {
            return mobile;
        }
        return mobile.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2");
    }

    public static String idEncrypt(String id) {
        if (TextUtils.isEmpty(id) || (id.length() < 8)) {
            return id;
        }
        return id.replaceAll("(?<=\\w{3})\\w(?=\\w{4})", "*");
    }
}
